cap program drop texgraph

program define texgraph
	syntax , title(string) data(string) name(string) width(string) file(string) replace notesize(string) note_paper(string)	/// Specs.
             inpath(string) path_paper(string)						/// Paths

    // Write LaTeX snippet to load graph
    tempname f
	
	/*Paper*/
	
    file open `f' using "`path_paper'`name'.tex", write `replace'
    file w `f' "\begin{figure}[ht!]" _n
    file w `f' "\centering" _n
    file w `f' "\begin{minipage}{`width'\textwidth}" _n
    file w `f' "\caption{`title'}" _n
	file w `f' "\rule{\textwidth}{0.4pt}" _n
	file w `f' "\vskip 5pt" _n
    file w `f' "\label{fig: `name'}" _n
    file w `f' "\includegraphics[width=\textwidth]{../results/graphs/`name'.`file'} \\" _n
	file w `f' " \""`notesize' \textbf{Data:} `data'.\\" _n
    file w `f' " \""`notesize' \textbf{Note:} `note_paper'\\" _n
    file w `f' "\end{minipage}" _n
    file w `f' "\end{figure}" _n
    file close `f'
	

end
